package week06;

import week06.AbstractPersonCmp;
import week06.Person;
import week06.PersonCmpByHeight;

import java.util.Random;

public class TestPersonCmp {

    public static void main(String[] args) {
        Person[] personArray = new Person[10];
        Random rdm = new Random();
        for( int i=0; i<10; i++ ) {
            personArray[i] = new Person("Person"+i, rdm.nextInt(200), rdm.nextInt(100) );
        }
        for( int i=0; i<10; i++ )
            System.out.println(personArray[i].getName() + " " + personArray[i].getHeight());


        System.out.println("After sort:");


        AbstractPersonCmp cmpOp = new PersonCmpByHeight();
        cmpOp.sort(personArray);
        for( int i=0; i<10; i++ )
            System.out.println(personArray[i].getName() + " " + personArray[i].getHeight());

    }
}